import pika


def get_connection():
    credentials = pika.PlainCredentials('admin', 'cae4a0de')
    connection = pika.BlockingConnection(pika.ConnectionParameters('38.6.223.112', 5672, '/', credentials,heartbeat=0))
    return connection
def get_connection1(username,password,host,port):
    credentials = pika.PlainCredentials(username, password)
    connection = pika.BlockingConnection(pika.ConnectionParameters(host,port, '/', credentials))
    return connection

class rabbit_class(object):
    def __init__(self,username,password,host,port,queue_name):
        connection=get_connection1(username,password,host,port)
        channel= connection.channel()
        MAX_PRIORITY=100
        channel.queue_declare(queue=queue_name, durable=True, arguments={
            'x-max-priority': MAX_PRIORITY
        })
        self.channel=channel